Why is the state undefined in redux